import { createStore } from 'redux'

let reducer = (state, action) => {
  let changeState = JSON.parse(JSON.stringify(state))
  switch (action.type) {
    case 'CHANGE_ITEM':
      changeState.navList = action.list
      return changeState
    default:
      return state
  }
}

let initState = {
  navList: [
    { title: '饿了么', flag: true },
    { title: '口碑好店', flag: true },
    { title: '市民中心', flag: true },
    { title: '电影演出', flag: true },
    { title: '转账', flag: true },
    { title: '充值中心', flag: true },
    { title: '余额宝', flag: true },
    { title: '花呗', flag: false },
    { title: '我的账本', flag: false },
    { title: '更多', flag: true }
  ]
}


let store = createStore(reducer, initState)

export default store
